# 冰激凌小店 　冰激凌小店是一种特殊的餐馆。
# 编写一个名为IceCreamStand 的类，让它继承为完成练习9-1或练习9-4而编写的Restaurant 类。
# 这两个版本的Restaurant 类都可以，挑选你更喜欢的那个即可。
# 添加一个名为flavors 的属性，用于存储一个由各种口味的冰激凌组成的列表。
# 编写一个显示这些冰激凌的方法。创建一个IceCreamStand 实例，并调用这个方法。

# restaurant.py
class Restaurant:
	"""模拟餐馆的运营"""

	def __init__(self, name, cuisine_type):
		"""初始化属性餐馆名restaurant_name和烹饪类型cuisine_type"""
		self.name = name
		self.cuisine_type = cuisine_type
		self.number_served = 0

	def describe_restaurant(self):
		"""概述餐馆名及其提供的菜式"""
		print(f"{self.name} restaurant provide {self.cuisine_type} food.")

	def open_restaurant(self):
		"""打印餐馆开门营业"""
		print(f"{self.name} restaurant is open now!")

	def display_number_served(self):
		"""打印餐馆已服务顾客数"""
		print(f"This restaurant has served {self.number_served} customer.")

	def set_number_served(self, number):	# 修改餐馆已服务顾客数
		"""修改餐馆已服务的顾客数"""
		self.number_served = number

	def increment_number_served(self, inc_num):
		"""按预设每天可能接待的就餐人数递增就餐人数"""
		self.number_served += inc_num

class IceCreamStand(Restaurant):
	"""模拟一家冰淇淋小店"""

	def __init__(self, name, cuisine_type):
		"""
		初始化父类Restaurant的属性。
		再初始化IceCreamStand特有的属性。
		"""
		super().__init__(name, cuisine_type)
		self.flavors = ['watermelon', 'strawberry', 'ormosia', 'peach']

	def describe_icecream(self):
		"""简要概述提供的冰淇淋口味"""
		print(f"\nWhat flavor ice cream do you like?")
		for flavor in self.flavors:
			print(flavor, end='\t')

restaurant1 = Restaurant('Happy Village', 'stewing')		# 蒸煮
restaurant2 = Restaurant('Dicos', 'fried')		# 油炸

print(f"The restaurant name is {restaurant1.name}.")
restaurant1.describe_restaurant()
restaurant1.open_restaurant()
restaurant1.display_number_served()
restaurant1.number_served = 200			# 直接更改类中已定义的属性值
restaurant1.display_number_served()

restaurant1.set_number_served(500)			# 通过方法修改属性的值
restaurant1.display_number_served()

restaurant1.increment_number_served(50)			# 通过方法进行递增（增加特定的值）
restaurant1.display_number_served()

print(f"\nAnother restaurant name is {restaurant2.name}.")
restaurant2.describe_restaurant()
restaurant2.open_restaurant()

icecreamstand1 = IceCreamStand('mixuebingcheng', 'dessert')
icecreamstand1.describe_icecream()
